<?php
class Programas_Form_Crearprograma extends Form_Base {
	
		
	public function __construct($options = null) {
		parent::__construct($options);
	}
	
	public function init() {
		//Crea el formulario para el registro de roles del sistema
		$this->setName ( 'sedes' );
		$this->setMethod("POST");
		
		$domConfig = Zend_Registry::get('domConfig'); //esto se crea en el bootstrap
		
		$array_elements[] = new Zend_Form_Element_Hidden("codprograma");
		$array_elements[] = new Zend_Form_Element_Hidden("codsede");
		
		
		$element = new App_Form_Element_Autocompletar("sede", "codsede", "/sedes/index/autolistasedes");
		$element->setLabel ( 'Sede / CUNAD : ' );
		$element->setAttribs(array('size'=>50));
		$element->setRequired ( true );
		$element->addFilter ( 'StripTags' );
		$element->addFilter ( 'StringTrim' );
		if ( App_User::getCodigoSede()){
			$element->setAttrib("readonly","readonly");
		}
		$array_elements[]=$element;

		$element = new Zend_Form_Element_Text ( 'codsnies' );
		$element->setLabel ( 'Código SNIES: ' );
		$element->addFilter ( 'StripTags' );
		$element->addFilter ( 'StringTrim' );
		$element->addValidator('digits');
        $array_elements[]=$element;

		$element = new Zend_Form_Element_Text ( 'nombreprograma' );
		$element->setLabel ( 'Nombre del programa: ' );
		$element->setRequired ( true );
		$element->addFilter ( 'StripTags' );
		$element->addFilter ( 'StringTrim' );
        $array_elements[]=$element;

		$element = new Zend_Form_Element_Text ( 'titulo' );
		$element->setLabel ( 'Título que otorga : ' );
		$element->setRequired ( true );
		$element->addFilter ( 'StripTags' );
		$element->addFilter ( 'StringTrim' );
		$array_elements[]=$element;
		
		
		$programas = new Programas_Model_Programas();
		$array_niveles = $programas->getNivelesacademicos();
		
		$element = new Zend_Form_Element_Select('codnivel');
		$element->setLabel ( 'Nivel académcio : ' );
		$element->setRegisterInArrayValidator(false);
		$element->setMultiOptions($array_niveles);
        $element->setRequired(true);
        $array_elements[]=$element;

        $array_metodologias = $programas->getMetodologias();
        		
        $element = new Zend_Form_Element_Select('codmetodologia');
		$element->setLabel ( 'Metodología : ' );
		$element->setRegisterInArrayValidator(false);
		$element->setMultiOptions($array_metodologias);
        $element->setRequired(true);
        $array_elements[]=$element;

        $element = new App_Form_Element_Autocompletar("ubicacion", "codubicacion", "/generales/ubicacion/autolista");
		$element->setLabel ( 'Ubicación : ' );
		$element->setAttribs(array('size'=>50));
		$element->setRequired ( true );
		$element->addFilter ( 'StripTags' );
		$element->addFilter ( 'StringTrim' );
		$array_elements[]=$element;

		$element = new Zend_Form_Element_Hidden("codubicacion");
		$array_elements[]=$element;
				
        $element = new App_Form_Element_Datepicker('fechavencimientorc');
		$element->setLabel('Fecha de vencimiento RC :');
		$element->setAttrib("readonly","readonly");
		$array_elements[] = $element;
				
        $element = new Zend_Form_Element_Select('estado');
		$element->setLabel ( 'Estado : ' );
		$element->setRegisterInArrayValidator(false);
		$element->setMultiOptions($domConfig->DOM_ESTADO->toArray());
        $element->setRequired(true);
        $array_elements[]=$element;
		     
       $submit = new Zend_Form_Element_Submit('btnSubmit');
       $submit->setValue('Guardar');
       $submit->setLabel("Guardar");
       $submit->setAttrib("class", "iceCmdBtn");
       $array_elements[] = $submit;
       
       $this->addElements($array_elements);
	   $this->loadTableDecorators();
	}

}